from rest_framework import serializers
from . import models



# 序列化员工
class UserSerializer(serializers.ModelSerializer):

    departname = serializers.CharField(source='depart.name',read_only=True)
    class Meta:
        model = models.User
        fields = '__all__'


# 序列化部门
class DepartmentSerializer(serializers.ModelSerializer):
    class Meta:
        model = models.Department
        fields = '__all__'